package com.cswnode.Config;

import com.cswnode.Annotations.LoginJudgment;
import com.cswnode.Controller.interceptor.LoginJudgmentInterceptor;
import com.cswnode.Controller.interceptor.LoginTicketInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author csw
 * @create 2020/9/18 13:31
 */
//拦截器配置类
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Autowired
    private LoginTicketInterceptor loginTicketInterceptor;
    @Autowired
    private LoginJudgmentInterceptor loginJudgmentInterceptor;

  @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginTicketInterceptor).
                excludePathPatterns("/**/*.css","/**/*/js","/**/*.png","/**/*.jpg","/**/*.jpeg");

        registry.addInterceptor(loginJudgmentInterceptor).
              excludePathPatterns("/**/*.css","/**/*/js","/**/*.png","/**/*.jpg","/**/*.jpeg");
    }


}
